package com.wmcsk;

import android.content.Context;

import com.wmcsk.dl.util.LogUtils;
import com.wmcsk.interfaces.InitResultListener;
import com.wmcsk.interfaces.KuaiyanAppDataStatisticsInterface;

/**
 * Created by wm on 2018/5/31.
 */

public class KuaiyanAppDataStatisticsSdk implements KuaiyanAppDataStatisticsInterface{
    private static KuaiyanAppDataStatisticsSdk kuaiyanAppDataStatisticsSdk;
    public static final String ERROR_TAG = "KuaiyanDataStatisticsSdk";
    private KuaiyanAppDataStatisticsSdk(){

    }
    public static KuaiyanAppDataStatisticsSdk getInstance(){
        if(kuaiyanAppDataStatisticsSdk == null){
            synchronized (KuaiyanSdk.class){
                if(kuaiyanAppDataStatisticsSdk == null){
                    kuaiyanAppDataStatisticsSdk = new KuaiyanAppDataStatisticsSdk();
                }
            }
        }
        return kuaiyanAppDataStatisticsSdk;
    }
    private KuaiyanAppDataStatisticsInterface kuaiyanAppDataStatisticsInterface;
    public void initKYDataStatisticsSdkInterface(KuaiyanAppDataStatisticsInterface kuaiyanDataStatisticsInterface){
        this.kuaiyanAppDataStatisticsInterface = kuaiyanDataStatisticsInterface;
    }
    @Override
    public String getVersion() {
        if(kuaiyanAppDataStatisticsInterface == null){
            LogUtils.getNewInstance(ERROR_TAG).eob("please wait sdkinit init complate");
            return "null";
        }
        return kuaiyanAppDataStatisticsInterface.getVersion();
    }

    @Override
    public void init(Context context, InitResultListener initResultListener) {
        if(kuaiyanAppDataStatisticsInterface == null) {
            LogUtils.getNewInstance(ERROR_TAG).eob("please wait sdkinit init complate");
            if(initResultListener!=null){
                initResultListener.initResult(-10);
            }
            return;
        }
        kuaiyanAppDataStatisticsInterface.init(context,initResultListener);
    }

    @Override
    public String getSdkInfo() {
        if(kuaiyanAppDataStatisticsInterface == null){
            LogUtils.getNewInstance(ERROR_TAG).eob("please wait sdkinit init complate");
            return "null";
        }
        return kuaiyanAppDataStatisticsInterface.getSdkInfo();
    }

    @Override
    public void setExtentionInfo(String extentionInfo) {
        if(kuaiyanAppDataStatisticsInterface == null){
            LogUtils.getNewInstance(ERROR_TAG).eob("please wait sdkinit init complate");
            return ;
        }
        kuaiyanAppDataStatisticsInterface.setExtentionInfo(extentionInfo);
    }
}
